<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('inventory_trans', function (Blueprint $table) {
            $table->id()->unique()->comment('id');
$table->string('docno', 200)->unique()->comment('变动来源单据号');
$table->tinyInteger('trans_type')->comment('变动类型：1入库,2出库，3库内移动');
$table->string('material_no', 200)->comment('原始品号');
$table->string('from_location', 120)->nullable()->comment('原始库位');
$table->string('from_lotnum', 200)->comment('原始箱号');
$table->string('from_unit', 10)->nullable()->comment('原始单位');
$table->decimal('qty')->comment('变动数量');
$table->string('to_location', 120)->comment('目标库位');
$table->string('to_lotnum', 200)->comment('目标箱号');
$table->string('to_unit', 10)->comment('目标单位');
$table->creatorId();
$table->createdAt();
$table->updatedAt();
$table->deletedAt();

$table->engine='InnoDB';
$table->comment('库存变动记录');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('inventory_trans');
    }
};
